use std::ops::Deref;
use std::sync::Arc;

use engine::{DB, DBRef};

pub type StateRef = Arc<State>;

pub struct State {
    pub db: DBRef,
}

impl State {
    #[inline]
    pub fn create(db: DBRef) -> Self {
        Self { db }
    }
}

impl Deref for State {
    type Target = dyn DB;

    fn deref(&self) -> &Self::Target {
        &*self.db
    }
}